package com.asdf.tests;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.Test;

import com.asdf.application.NetServiceSimulator;
import com.asdf.db.DataBase;
import com.asdf.db.DataBase.DataSource;
import com.asdf.entities.CompanyClub;

public class InsertClubTest extends ClubTest
{
	@SuppressWarnings({ "unchecked" })
	@Test
	public void insertClubs()
	{
		NetServiceSimulator simulator = new NetServiceSimulator( );
		CompanyClub club = null;
		List<CompanyClub> list = null;
		
		simulator.loadClubs("clubs.xml");
		list = (List<CompanyClub>)DataBase.getInstance( ).getDataSource( DataSource.CompanyClubs);
		
		assertEquals("listLength", list.size(), arr.length);
		for (int i = 0; i < arr.length; ++i)
		{
			club = list.get(i);
			assertEquals("clubCompany[" + i + "][id]", arr[i][0], club.getId());
			assertEquals("clubCompany[" + i + "][name]", arr[i][1], club.getCompanyName());
			assertEquals("clubCompany[" + i + "][country]", Double.parseDouble(arr[i][2]), club.getDiscount());
		}
	}
}
